package net.csdn.business.common.config.oss;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;

import java.util.List;

/**
 * @author likun
 * @date 2023/1/4 19:02
 */
@Data
@Configuration
@RefreshScope
public class ApiConfigData {
    /**
     * 令牌自定义标识
     */
    @Value("${repeat.token.header:uuid}")
    private String repeatHeader;

    @Value("${repeat.enabled:true}")
    private boolean repeatEnabled;

    @Value("${cors.access.control.allow.headers:Cookie,Authorization,Origin,content-type,Accept,x-ca-key,x-ca-nonce,x-ca-signature,x-ca-signature-headers,x-ca-stage,x-ca-signed-content-type,token,}")
    private String accessControlAllowHeaders;

    @Value("#{'${cors.access.origins:127.0.0.1,localhost,127.0.0.1:333,localhost:3333,csdn.net}'.split(',')}")
    private List<String> allowOrigins;

    /**
     * 上报频率限制
     */
    @Value("${report.rate.limit:30}")
    private int reportRateLimit;

    @Value("${thread.common.limit:1000}")
    private int threadCommonLimit;

    @Value("${atom.git.host:https://atomgit.com}")
    private String atomGitHost;

    @Value("${image.host:https://community.codechina.net}")
    private String imgUrl;

    /**
     * 用户默认头像
     */
    @Value("${user.default.photo:/uploads/user/default.png}")
    private String userDefaultPhoto;

    /**
     * cookie 域
     */
    @Value("${cookie.domain:atomgit.com}")
    private String cookieDomain;

    @Value("${cache.redis.prefix:at}")
    private String redisKeyPrefix;
    @Value("${cache.default.time.out:60}")
    private Integer redisDefaultTimeOut;
}